//
//  UIBarButtonItem_Extension.swift
//  weibo
//
//  Created by Felix on 16/11/6.
//  Copyright © 2016年 Felix. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
     convenience init(_ imageName:String ,  target: Any?, action: Selector) {
        let btn = UIButton.init()
        
        btn.setImage(UIImage.init(named: imageName), for: UIControlState.normal)
        btn.setImage(UIImage.init(named: imageName+"_highlighted"), for: UIControlState.highlighted)
        
        btn .addTarget(target, action: action, for: UIControlEvents.touchUpInside)
        btn.sizeToFit()
        
        self.init()
        self.customView = btn
    }
}
